package com.company.framework.common.exception.util;


import com.company.framework.common.enums.RedisKeyEnum;

/**
 * RedisKey生成
 *
 * @author robet
 */
public class RedisKeyUtil {

	/**
	 * 生成RedisKey
	 * @param keyEnum RedisKey枚举
	 * @param ids 额外标识
	 * @return
	 */
	public static String genRedisKey(RedisKeyEnum keyEnum, String... ids) {
		StringBuffer buffer = new StringBuffer();
		buffer.append(keyEnum.getProject()).append(":");
		buffer.append(keyEnum.getModule()).append(":");
		buffer.append(keyEnum.getKey());
		if(ids != null){
			for(String id : ids){
				buffer.append(":");
				buffer.append(id);
			}
		}
		return buffer.toString();
	}
}
